package benchmarks;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * List of the database management systems that we support
 * in the framework.
 * @author pavlo
 */
public enum DatabaseType {

    /**
     * Parameters:
     * (1) JDBC Driver String
     * (2) Should SQLUtil.getInserSQL escape table/col names
     * (3) Should SQLUtil.getInserSQL include col names
     */
    MYSQL("com.mysql.jdbc.Driver"),
    MONGODB(""),
    REDIS("")
    ;

    private DatabaseType(String driver) {
        this.driver = driver;
    }

    /**
     * This is the suggested driver string to use in the configuration xml
     * This corresponds to the <B>'driver'</b> attribute.
     */
    private final String driver;


    // ---------------------------------------------------------------
    // ACCESSORS
    // ----------------------------------------------------------------

    /**
     * Returns the suggested driver string to use for the given database type
     * @return
     */
    public String getSuggestedDriver() {
        return (this.driver);
    }

    // ----------------------------------------------------------------
    // STATIC METHODS + MEMBERS
    // ----------------------------------------------------------------

//    protected static final Map<Integer, DatabaseType> idx_lookup = new HashMap<Integer, DatabaseType>();
//    protected static final Map<String, DatabaseType> name_lookup = new HashMap<String, DatabaseType>();
//    static {
//        for (DatabaseType vt : EnumSet.allOf(DatabaseType.class)) {
//            DatabaseType.idx_lookup.put(vt.ordinal(), vt);
//            DatabaseType.name_lookup.put(vt.name().toUpperCase(), vt);
//        }
//    }
//
//    public static DatabaseType get(String name) {
//        DatabaseType ret = DatabaseType.name_lookup.get(name.toUpperCase());
//        return (ret);
//    }
}
